<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>来一个简单的时间计时</title>
    <script>
        function myFunction() {
            var x = document.getElementById('txt');
            var t1 = setTimeout(function () {
                x.value = "2 秒";
            }, 2000);
            var t2 = setTimeout(function () {
                x.value = "4 秒";
            }, 4000);
            var t3 = setTimeout(function () {
                x.value = "6 秒";
            }, 6000);
        }
    </script>
</head>
<body>
<form>
    <input type="button" value="显示文件时间！" onclick="myFunction()" />
    <input type="text" id="txt" />
</form>
</body>
</html>